package cn.cheln.support.manager;

import android.content.Intent;
import cn.cheln.explorer.ds.scan.ScanService;
import cn.cheln.support.data.text.xml.SPUtil;
import cn.cheln.support.manager.listener.HomeListener;
import com.direction.hold.FileApp;
import com.direction.hold.ui.CommonActivity;
import com.direction.hold.ui.SlideActivity;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ActivityPool
{
  private static ActivityPool instance;
  public Map<Class, CommonActivity> activityMap = new HashMap();

  public static ActivityPool getInstance()
  {
    if (instance == null)
      instance = new ActivityPool();
    return instance;
  }

  public void addActivity(CommonActivity paramCommonActivity)
  {
    if (this.activityMap.containsValue(paramCommonActivity))
      return;
    this.activityMap.put(paramCommonActivity.getClass(), paramCommonActivity);
  }

  public void exit()
  {
    SPUtil.putValue(SlideActivity.fileActivityInstance, "ApkRememberedPage", "apk", "");
    SlideActivity.fileActivityInstance.stopService(new Intent(SlideActivity.fileActivityInstance, ScanService.class));
    HashSet localHashSet = new HashSet(this.activityMap.values());
    Iterator localIterator = localHashSet.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        localHashSet.clear();
        HomeListener.stopInstall();
        System.exit(0);
        return;
      }
      ((CommonActivity)localIterator.next()).finish();
    }
  }

  public void refresh()
  {
    refresh(null);
  }

  public void refresh(CommonActivity paramCommonActivity)
  {
    Iterator localIterator = this.activityMap.keySet().iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
        return;
      Class localClass = (Class)localIterator.next();
      if ((paramCommonActivity != null) && (localClass == paramCommonActivity.getClass()))
        continue;
      ((CommonActivity)this.activityMap.get(localClass)).refresh();
    }
  }

  public void rmActivity(CommonActivity paramCommonActivity)
  {
    if (!(this.activityMap.containsKey(paramCommonActivity.getClass())))
      return;
    this.activityMap.remove(paramCommonActivity.getClass());
  }

  public void sortrefresh()
  {
    sortrefresh(null);
  }

  public void sortrefresh(CommonActivity paramCommonActivity)
  {
    Iterator localIterator = this.activityMap.keySet().iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
        return;
      Class localClass = (Class)localIterator.next();
      if ((paramCommonActivity != null) && (localClass == paramCommonActivity.getClass()))
        continue;
      ((CommonActivity)this.activityMap.get(localClass)).sort();
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.support.manager.ActivityPool
 * JD-Core Version:    0.5.2
 */